﻿<%@ Page Title="Role ACL" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="RoleACL.aspx.cs" Inherits="IFD2.RoleACL" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <form id="form1" runat="server" role="form" class="form-inline" defaultbutton="lbtnQuery">
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate>
    <div class="container-fluid body-content" style="width:100%;">

    <div class="row">
        <div class="col-sm-2 well well-sm">
            <h5><asp:Literal ID="litTitle" runat="server" meta:resourcekey="tipPageTitle"></asp:Literal></h5>
            <div class="form-group">
                <asp:Label ID="Label1" runat="server" Text="Office:" meta:resourcekey="Office"></asp:Label>
                <asp:Label ID="lblOffice" runat="server" Font-Bold="True"></asp:Label><br />
                <asp:Label ID="Label2" runat="server" Text="Role:" meta:resourcekey="Role"></asp:Label>
                <asp:Label ID="lblRole" runat="server" Font-Bold="True"></asp:Label><br />
                <%--<asp:Label ID="Label4" runat="server" Text="Function Type:" meta:resourcekey="FunctionType"></asp:Label>
                <asp:DropDownList ID="lstTypes" runat="server" CssClass="form-control input-sm" Width="100%">
                    <asp:ListItem Selected="True" Value="GEN" meta:resourcekey="General">General</asp:ListItem>
                    <asp:ListItem Value="COR" meta:resourcekey="Root">Root</asp:ListItem>
                    <asp:ListItem Value="NET" meta:resourcekey="Network">Network</asp:ListItem>
                    <asp:ListItem Value="FAR" meta:resourcekey="Fares">Fares</asp:ListItem>
                    <asp:ListItem Value="INV" meta:resourcekey="Inventory">Inventory</asp:ListItem>
                    <asp:ListItem Value="SAL" meta:resourcekey="Sale">Sale</asp:ListItem>
                    <asp:ListItem Value="DEP" meta:resourcekey="Departure">Departure</asp:ListItem>
                </asp:DropDownList>--%>
            </div>
            <br class="hidden-xs"/><br class="hidden-xs"/>
            <asp:LinkButton ID="lbtnQuery" runat="server" CssClass="form-control input-sm btn-primary text-center" Width="100%" ToolTip="" meta:resourcekey="tipQuery" OnClick="lbtnQuery_Click"> <span class="glyphicon glyphicon-search" style="font-size:large;"></span></asp:LinkButton>
            <p></p><%--没有此行(或&nbsp;)，上面的按钮在手机模式(xs)下，只有上半部可以点击！--%>
        </div>

        <div class="col-sm-10 well well-sm">
            <div class="panel">
                <div class="panel-heading btn-primary">
                    <h6 class="panel-title" id="section-2"><asp:Literal ID="Literal1" runat="server" meta:resourcekey="AuthorizedFunctions2"></asp:Literal></h6>
                </div>
                <div class="panel-body">
                    <div class="table-responsive">
                        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4" style="min-width:500px;width:50%;" class="table-hover"
                            DataKeyNames="access_code" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None">
                            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                            <Columns>
                                <asp:TemplateField>
                                    <ItemTemplate>
                                        <input name="KEY" type="radio" value='<%# Eval("access_code") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="access_code" HeaderText="access_code" ReadOnly="True" SortExpression="access_code" meta:resourcekey="access_code" Visible="false"/>
                                <asp:BoundField DataField="description" HeaderText="description" SortExpression="description" meta:resourcekey="description" />
                            </Columns>
                            <RowStyle BackColor="#EFF3FB" />
                            <EditRowStyle BackColor="#2461BF" />
                            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                            <AlternatingRowStyle BackColor="White" />
                        </asp:GridView>

                        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:IFD_DB %>"
                            SelectCommand="bll_role_get_acl" SelectCommandType="StoredProcedure" DataSourceMode="DataReader">
                            <SelectParameters>
                                <%--<asp:ControlParameter ControlID="lstTypes" Name="func_type" PropertyName="SelectedValue" Type="String" />--%>
                                <asp:ControlParameter ControlID="lblOffice" Name="office" PropertyName="Text" Type="String" />
                                <asp:ControlParameter ControlID="lblRole" Name="role" PropertyName="Text" Type="String" />
                                <asp:SessionParameter Name="lang" SessionField="LANG" Type="String" />
                            </SelectParameters>
                        </asp:SqlDataSource>
                    </div>
                    <asp:Button ID="btnRemove" runat="server" CssClass="btn btn-sm btn-default" Text="Remove" OnClick="btnRemove_Click"  meta:resourcekey="Remove" />

                    <div class="well well-sm">
                         <asp:Label ID="Label3" runat="server" Text="Avail. Functions:" meta:resourcekey="NewFunction"></asp:Label><br />
                        <asp:ListBox ID="lstAvailFunc2" runat="server" DataSourceID="sqlAvailAcl" DataTextField="description" DataValueField="access_code" Rows="10" style="max-width:768px;width:100%;"></asp:ListBox>
                        <asp:SqlDataSource ID="sqlAvailAcl" runat="server" ConnectionString="<%$ ConnectionStrings:IFD_DB %>"
                            SelectCommand="bll_role_get_avail_acl" SelectCommandType="StoredProcedure" DataSourceMode="DataReader">
                            <SelectParameters>
                                <%--<asp:ControlParameter ControlID="lstTypes" Name="func_type" PropertyName="SelectedValue" Type="String" />--%>
                                <asp:ControlParameter ControlID="lblOffice" Name="office" PropertyName="Text" Type="String" />
                                <asp:ControlParameter ControlID="lblRole" Name="role" PropertyName="Text" Type="String" />
                                <asp:SessionParameter Name="lang" SessionField="LANG" Type="String" />
                            </SelectParameters>
                        </asp:SqlDataSource>
                        <br />
                        <asp:Button ID="btnAdd" runat="server" Text="Add" OnClick="btnAdd_Click" CssClass="btn btn-sm btn-default" meta:resourcekey="Add" />
                        <br />
                        <asp:Label ID="lblError" runat="server" CssClass="ifdMessage"></asp:Label>
                    </div>

                </div>
            </div>
        </div>
    </div>

    </div>
    </ContentTemplate></asp:UpdatePanel>
    </form>

    <script src="JS/ScrollableGridPlugin.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            var win_height = parseInt($(window).height());
            var tab_new_height= win_height-50-100;//菜单占50， 为便于操作留空100
            if ($('#<%=GridView1.ClientID %>').height()>tab_new_height)
                $('#<%=GridView1.ClientID %>').Scrollable({ ScrollHeight: tab_new_height });
        });
    </script>

</asp:Content>
